<template>
  <div id="app" v-cloak>
    <!--    <keep-alive>
        <router-view v-if="$route.meta.keepAlive"></router-view>
     </keep-alive> -->
    <router-view />
    <!-- <router-view  /> -->
  </div>
</template>
<script>
import config from '@/config'

function isInCMBApp() {
  const ua = navigator.userAgent.toLowerCase() // 统一转成小写
  const cmbKeywords = [
    'cmb'
  ]
  return cmbKeywords.some(keyword => ua.includes(keyword))
}

export default {
  name: 'App',
  created() {
    // 检测登录
    if (!this.$store.getters.data && isInCMBApp()) {
      const url = config.cmbLoginUrl
      // let url = 'http://xft-demo.cmburl.cn/app-wlf/#/xftMobile'
      // let url = 'http://xft.cmbchina.com/gateway/login?appCode=a94c1508-bec6-410d-97ec-4d135c945e70&prjCode=XFV86863&returnUrl=http://cczhr.ziniunet.com/dist/'
      window.location.href = url
    }
  },
  mounted() {
    window.onload = function() {
      document.addEventListener('touchstart', function(event) {
        if (event.touches.length > 1) {
          event.preventDefault()
        }
      })
      document.addEventListener('gesturestart', function(event) {
        event.preventDefault()
      })
    }
  }
}
</script>
<style >
[v-cloak] {
  display: none !important;
}
</style>
